//
//  AudioTableViewCell.m
//  Project_A
//
//  Created by running on my way on 15/1/16.
//  Copyright (c) 2015年 Flowers. All rights reserved.
//

#import "AudioTableViewCell.h"

@implementation AudioTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatSubView];
        self.backgroundColor = [UIColor colorWithRed:254/256.0 green:246/256.0 blue:226/256.0 alpha:0.5];
    }
    return self;
}

- (void)creatSubView
{
    self.onlineLab = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 30, 20)];
    self.onlineLab.backgroundColor = [UIColor redColor];
    self.onlineLab.text = @"在线";
    self.onlineLab.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:self.onlineLab];
    [self.onlineLab release];
    self.nameLab = [[UILabel alloc] initWithFrame:CGRectMake(50, 10, 300, 20)];
    self.nameLab.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.nameLab];
    [self.nameLab release];
    self.playNumLab = [[UILabel alloc] initWithFrame:CGRectMake(10, 40, 300, 20)];
    self.playNumLab.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.playNumLab];
    [self.playNumLab release];
    
}

-(void)setModel:(AudioModel *)model
{
    if (_model != model) {
        [_model release];
      _model = [model retain];
        
    }
    self.nameLab.text = _model.audioName;
    self.playNumLab.text = [NSString stringWithFormat:@"%@ %@ %@", @"播放次数:", model.audioPlayNum, @"次"];
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
